package com.superjson.showpro.entity;

import com.superjson.showpro.base.BaseObj;
import com.beantools.annotation.NotNull;
import com.superjson.showpro.shared.enums.CommentTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;

@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@Table(name = "sp_comment")
public class Comment extends BaseObj implements Serializable{


    private static final long serialVersionUID = 5471057324770159893L;
    /**
     * 文章目录
     */
    @ManyToOne
    @JoinColumn(name = "article_catalog_id")
    private ArticleCatalog articleCatalog;

    /**
     * 用户
     */
    @ManyToOne
    @JoinColumn(name = "user_id")
    private User user;

    /**
     * 评论类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "comment_type")
    private CommentTypeEnum commentType;

    /**
     * 评论内容
     */
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "content", columnDefinition = "longtext" )
    @NotNull
    private String content;



}